import http from '@/utils/http.js';

/**
 * 获取短信验证码
 * @param {Object} data
 * @returns
 */
export function getSmsCodeApi(data) {
  return http({
    url: '/tool/sms_send',
    method: 'post',
    data: data
  });
}

/**
 * 获取邮箱验证码
 * @param {Object} data 
 * @returns
 */
export function getEmailCodeApi(data) {
  return http({
    url: '/tool/email_send',
    method: 'post',
    data: data
  });
}

/**
 * 注册
 * @param {Object} data 
 * @returns
 */
export function registerApi(data) {
  return http({
    url: '/login/register',
    method: 'post',
    data: data
  });
}

/**
 * 重置密码
 * @param {Object} data 
 * @returns
 */
export function resetPasswordApi(data) {
  return http({
    url: '/login/forget',
    method: 'post',
    data: data
  });
}

/**
 * 账号密码登录
 * @param {Object} data 
 * @returns
 */
export function loginApi(data) {
  return http({
    url: '/login/login',
    method: 'post',
    data: data
  });
}

/**
 * 获取微信登陆二维码地址
 * @param {Object} params {url : String(重定向url)}
 * @returns
 */
export function getWechatQrCodeApi(params) {
  return http({
    url: '/login/redirect_url',
    method: 'get',
    params: params
  });
}

/**
 * 微信扫码登陆
 * @param {Object} params {code : String(微信返回code)}
 * @returns
 */
export function wechatLoginApi(params) {
  return http({
    url: '/login/wx_login',
    method: 'get',
    params
  });
}
